//加载公共样式
require('../../assets/css/index.less')

//加载自己的样式
require('./ride.less')

//引入foot渲染函数
const renderFoot = require('../../utils/foot.js')
    //导入navbar
const renderNavbar = require('../../utils/navbar')
window.onload = () => {
    //渲染tabbar
    renderFoot('run')
    renderNavbar('ride')

    //创建实例
    var map = new BMapGL.Map('container')
    var point = new BMapGL.Point(104.079041, 30.495699)
    map.centerAndZoom(point, 15)
    map.enableScrollWheelZoom(true) //开启鼠标滚轮缩放

    //var scaleCtrl = new BMapGL.ScaleControl() // 添加比例尺控件
    // map.addControl(scaleCtrl)
    //var zoomCtrl = new BMapGL.ZoomControl() // 添加缩放控件
    // map.addControl(zoomCtrl)
    var cityCtrl = new BMapGL.CityListControl() // 添加城市列表控件
    map.addControl(cityCtrl)

    var geolocation = new BMapGL.Geolocation()
    geolocation.getCurrentPosition(function(r) {
        if (this.getStatus() == BMAP_STATUS_SUCCESS) {
            var mk = new BMapGL.Marker(r.point)
            map.addOverlay(mk)
            map.panTo(r.point)
            alert('您的位置：' + r.point.lng + ',' + r.point.lat)
        } else {
            alert('failed' + this.getStatus())
        }
    })
}